package com.times.happy_every_day.time;

import cn.hutool.core.date.DateUtil;
import com.times.happy_every_day.controller.WxjavaTestController;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@Slf4j
public class SpringTaskJob {

    @Autowired
    private WxjavaTestController wxjavaTestController;

    @Scheduled(cron ="0 0 0/1 * * ? ")
    public void task() throws WxErrorException {
        wxjavaTestController.sendTemplateMessage();
        log.info("已推送......." + DateUtil.formatDate(new Date()));
    }
}
